package top.yuyufeng.learn.lucene.solr;

/**
 * @author yuyufeng
 * @date 2017/12/6
 */
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.solr.core.query.result.HighlightPage;
import org.springframework.data.solr.repository.Highlight;
import org.springframework.data.solr.repository.Query;
import org.springframework.data.solr.repository.SolrCrudRepository;

/**
 * @author yuyufeng
 */
public interface BlogCoreRepository extends SolrCrudRepository<BlogCore, Long> {
    /**
     * 搜索所有   //(value = "*:*", filters = {"title北京市"})
     * @param page
     * @return
     */
    @Override
    @Query(value = "*:*")
    Page<BlogCore> findAll(Pageable page);

    /**
     * 通过关键词搜索
     * @param keywords
     * @param page
     * @return
     */
    @Highlight(prefix = "<B>", postfix = "</B>")
    HighlightPage<BlogCore> findByKeywords(String keywords, Pageable page);
}